//
//  HLRechargeAttachment.m
//  YueYue
//
//  Created by hulu001 on 2023/6/13.
//

#import "HLRechargeAttachment.h"

@implementation HLRechargeAttachment

- (nonnull NSString *)encodeAttachment {
    NSDictionary *dict = @{
                           @"msgType" : @(2),
                           @"ext" : @{
                               @"content" : self.content?:@"",
                               @"msgCount" : self.msgCount?:@"",}
                           };
    
    NSData *data = [NSJSONSerialization dataWithJSONObject:dict
                                                   options:0
                                                     error:nil];
    NSString *content = nil;
    if (data) {
        content = [[NSString alloc] initWithData:data
                                        encoding:NSUTF8StringEncoding];
    }
    return content;
}

- (CGSize)contentSize:(NIMMessage *)message cellWidth:(CGFloat)width
{
    return CGSizeMake(260, 74);
}

- (NSString *)cellContent:(NIMMessage *)message
{
    return @"HLRechargeContentView";
}

- (UIEdgeInsets)cellInsets:(NIMMessage *)message
{
    CGFloat left = (SCREEN_WIDTH - [self contentSize:message cellWidth:0].width) * 0.5;
    return UIEdgeInsetsMake(8, left, 28, left);
}

- (UIEdgeInsets)contentViewInsets:(NIMMessage *)message
{
    return UIEdgeInsetsZero;
}

- (BOOL)shouldShowAvatar:(NIMMessage *)message
{
    return NO;
}
@end
